package com.gxc.utils;

import lombok.Data;

/**
 * @author GongXincheng
 * @since 2019-07-30 15:55
 */
@Data
public class RestControllerResult<T> {
    private boolean success;
    private String errorMsg;
    private T data;

    public RestControllerResult() {
    }

    public RestControllerResult(boolean success, T data) {
        this.success = success;
        this.data = data;
    }

    public RestControllerResult(boolean success, String errorMsg) {
        this.success = success;
        this.errorMsg = errorMsg;
    }

    public RestControllerResult(boolean success, String errorMsg, T data) {
        this.success = success;
        this.errorMsg = errorMsg;
        this.data = data;
    }

    public static <T> RestControllerResult<T> success(T data) {
        return new RestControllerResult<>(true, data);
    }
}
